package com.zem.imos.Entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zem.imos.Entity.Enum.Marriage;
import com.zem.imos.Entity.Params.ParamsPatient;
import lombok.Data;

@Data
public class Patient  {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private Long userId;
    private Marriage marriage;
    private Integer weight;
    private Integer height;
    private String address;
    private String bloodtype;
    public Patient()
    {

    }

    public void setMarriage (Integer flag)
    {
        switch (flag){
            case 0 :
                this.marriage = Marriage.Unmarried;
                break; //可选
            case 1 :
                this.marriage = Marriage.Married;
                break; //可选
            default :
                this.marriage = Marriage.Unmarried;
        }
    }

    public Patient (ParamsPatient parmas)
    {
        this.id = parmas.getId();
        this.userId = parmas.getUserId();
        this.setMarriage(parmas.getMarriage());
        this.weight = parmas.getWeight();
        this.height = parmas.getHeight();
        this.address = parmas.getAddress();
        this.bloodtype = parmas.getBloodtype();

    }
}
